<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    {{message}}
    <cpn1></cpn1>
    <cpn2></cpn2>
</div>


<script src="../../js/vue.js"></script>

<script>
    const cpnCon1 = Vue.extend({
        template: `
            <div>
                <h2>这是组件1</h2>
            </div>
        `
    });

    const cpnCon3 = Vue.extend({
        template: `
            <div>
                <h2>这是组件3</h2>
            </div>
        `
    });
    
    const cpnCon2 = Vue.extend({
        template: `
            <div>
                <h2>这是组件2</h2>
                <cpn3></cpn3>
            </div>
            
        `,
        components: {
            cpn3: cpnCon3
        }
    });
    
    
    // 相当于root组件
    const vue = new Vue({
        el: "#app",
        data: {
            message: "Hello vue,你好！"
        },
        methods: {
            
        },
        components: {
            cpn1: cpnCon1,
            cpn2: cpnCon2
        }
    });
</script>
</body>
</html>